//
//  NuBridgedBlock.h
//  Nu
//
//  Created by Tim Burks on 4/24/16.
//
//

#import <Foundation/Foundation.h>
#import "NuInternals.h"

#ifdef __BLOCKS__
/*!
 @class NuBridgedBlock
 @abstract Generates a C block that wraps a nu block
 @discussion This class makes a C block that wraps a nu block using a supplied
 Objective-C-style function signature. This works by copying a dummy c block and
 then writing over its function pointer with a libFFI-generated closure function.
 */
@interface NuBridgedBlock : NSObject

/*! Returns a C block that wraps the supplied nu block using the supplied
 Objective-C-style function signature.
 */
+(id)cBlockWithNuBlock:(NuBlock*)nb signature:(NSString*)sig;

/*! Initializes a NuBridgedBlock object using a NuBlock and an Objective-C-style
 function signature. A C block is generated during the initialization.
 */
-(id)initWithNuBlock:(NuBlock*)nb signature:(NSString*)sig;

/*! Returns the NuBlock associated with the NuBridgedBlock object.
 */
-(NuBlock*)nuBlock;

/*! Returns the C block generated by the NuBridgedBlock object.
 */
-(id)cBlock;

@end
#endif //__BLOCKS__
